package cn.sczhyt.modules.szhy.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.sczhyt.common.utils.PageUtils;
import cn.sczhyt.common.utils.Query;

import cn.sczhyt.modules.szhy.dao.MeetingTopicsDao;
import cn.sczhyt.modules.szhy.entity.MeetingTopicsEntity;
import cn.sczhyt.modules.szhy.service.MeetingTopicsService;
import org.springframework.transaction.annotation.Transactional;


@Service("meetingTopicsService")
public class MeetingTopicsServiceImpl extends ServiceImpl<MeetingTopicsDao, MeetingTopicsEntity> implements MeetingTopicsService {
    @Autowired
    private MeetingTopicsDao meetingTopicsDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MeetingTopicsEntity> page = this.page(
                new Query<MeetingTopicsEntity>().getPage(params),
                new QueryWrapper<MeetingTopicsEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public IPage<MeetingTopicsEntity> findList(Integer page, Integer limit,String meetingId,MeetingTopicsEntity meetingTopicsEntity) {

        Page<MeetingTopicsEntity> pages = new Page<>(page, limit);

        return meetingTopicsDao.findList(pages,meetingId,meetingTopicsEntity);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateByTopics(String topicsId, Integer ifTopics) {
        meetingTopicsDao.updateByTopics(topicsId,ifTopics);
    }

}